﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace LearningEnglish.Controllers
{

    /// <summary>
    /// 使action能接受外部ajax跨域请求
    /// </summary>
    public class AcceptExAjaxAttribute : ActionFilterAttribute
    {
        public AcceptExAjaxAttribute()
        {
            Order = -1;
        }

        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            filterContext.HttpContext.Response.AppendHeader("Access-Control-Allow-Origin", "*");
            base.OnActionExecuting(filterContext);
        }
    }
}